<template>
  <div id="app">
    <h2>测试题</h2>
    <SubjectItem :list="list"></SubjectItem>
    <div>
      <FlagItem :answerList="answerList"></FlagItem>
    </div>
  </div>
</template>

<script>
import FlagItem from './components/FlagItem.vue';
import SubjectItem from './components/SubjectItem.vue';

export default {
  components: {
    SubjectItem,
    FlagItem
  },
  data() {
    return {
      list: [],
      answerList: []
    }
  },
  mounted() {
    this.getList()
    console.log(this.list);
  },
  methods: {
    getList() {
      for (let i = 0; i < 5; i++) {
        const num1 = Math.floor(Math.random() * 100)
        const num2 = Math.floor(Math.random() * 100)
        this.list.push({
          first: num1,
          last: num2,
          answer: num1 + num2
        })
      }
    }
  }
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>